[POWERPC][XEN] Remove boot wrapper, and extensive Makefile simplifications.
authorHollis Blanchard <hollisb@us.ibm.com>
Wed, 4 Oct 2006 22:17:41 +0000 (17:17 -0500)
committerHollis Blanchard <hollisb@us.ibm.com>
Wed, 4 Oct 2006 22:17:41 +0000 (17:17 -0500)
Instead of embedding the 64-bit Xen image inside a 32-bit "boot wrapper", we
can just use objcopy. This combines boot32.S and start.S, and removes the boot/
subdirectory entirely.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
--HG--
rename : xen/arch/powerpc/boot/start.S => xen/arch/powerpc/start.S
extra : transplant_source : %85P%AE%9D%12bgc5zR%A1%AA%0Fh%2A%2A%82%B2%90

.hgignore
xen/arch/powerpc/Makefile
xen/arch/powerpc/boot/boot32.S [deleted file]
xen/arch/powerpc/boot/start.S [deleted file]
xen/arch/powerpc/start.S [new file with mode: 0644]

index a3e3bd2f20165d57de2bfbb8d3db6aa9bb04bd1e..8e06df448d24ec93f7620d289a91aa106be3dd45 100644 (file)
--- a/.hgignore
+++ b/.hgignore
 ^xen/arch/powerpc/dom0\.bin$
 ^xen/arch/powerpc/asm-offsets\.s$
 ^xen/arch/powerpc/firmware$
-^xen/arch/powerpc/firmware_image$
+^xen/arch/powerpc/firmware_image.bin$
 ^xen/arch/powerpc/xen\.lds$
 ^xen/arch/powerpc/.xen-syms$
 ^xen/arch/powerpc/xen-syms.S$
index 6381e031ba640f15a6d859e1d2969197962bcee1..c25a8964ad48a39969c1f1d12a68284013faebce 100644 (file)
@@ -54,11 +54,6 @@ PPC_C_WARNINGS += -Wundef -Wmissing-prototypes -Wmissing-declarations
 PPC_C_WARNINGS += -Wshadow
 CFLAGS += $(PPC_C_WARNINGS)
 
-LINK=0x400000
-boot32_link_base = $(LINK)
-xen_link_offset  = 100
-xen_link_base    = $(patsubst %000,%$(xen_link_offset),$(LINK))
-
 #
 # The following flags are fed to gcc in order to link several
 # objects into a single ELF segment and to not link in any additional
@@ -69,17 +64,9 @@ OMAGIC = -N -nodefaultlibs -nostartfiles
 firmware: of_handler/built_in.o $(TARGET_SUBARCH)/memcpy.o of-devtree.o
        $(CC) $(CFLAGS) $(OMAGIC) -e __ofh_start -Wl,-Ttext,0x0 $^ -o $@
 
-firmware_image: firmware
+firmware_image.bin: firmware
        $(CROSS_COMPILE)objcopy --output-target=binary $< $@
 
-firmware_image.o: firmware_image
-       $(CROSS_COMPILE)objcopy --input-target=binary \
-               --output-target=elf64-powerpc \
-               --binary-architecture=powerpc \
-               --redefine-sym _binary_$<_start=$(@:%.o=%)_start \
-               --redefine-sym _binary_$<_end=$(@:%.o=%)_end \
-               --redefine-sym _binary_$<_size=$(@:%.o=%)_size  $< $@
-
 #
 # Hacks for included C files
 #
@@ -93,10 +80,7 @@ IMAGENAME = xen
 CMDLINE = ""
 boot_of.o: CFLAGS += -DCMDLINE="\"$(IMAGENAME) $(CMDLINE)\""
 
-start.o: boot/start.S
-       $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
-
-TARGET_OPTS = $(OMAGIC) -Wl,-Ttext,$(xen_link_base),-T,xen.lds
+TARGET_OPTS = $(OMAGIC) -Wl,-Ttext,0x400000,-T,xen.lds
 TARGET_OPTS += start.o $(ALL_OBJS)
 
 .xen-syms: start.o $(ALL_OBJS) xen.lds
@@ -119,22 +103,12 @@ xen-syms.o: xen-syms.S
 $(TARGET)-syms: start.o $(ALL_OBJS) xen-syms.o xen.lds
        $(CC) $(CFLAGS) $(TARGET_OPTS) xen-syms.o -o $@
 
-$(TARGET).bin: $(TARGET)-syms
-       $(CROSS_COMPILE)objcopy --output-target=binary $< $@
-
-$(TARGET).bin.o: $(TARGET).bin
-       $(CROSS_COMPILE)objcopy --input-target=binary \
+# our firmware only loads 32-bit ELF files
+$(TARGET): $(TARGET)-syms
+       $(CROSS_COMPILE)objcopy \
+               --input-target=elf64-powerpc \
                --output-target=elf32-powerpc \
-               --binary-architecture=powerpc  $< $@
-
-boot32.o: boot/boot32.S
-       $(CC) -m32 -Wa,-a32,-mppc64bridge \
-               -D__ASSEMBLY__ -D__BRIDGE64__ $(CFLAGS) -c $< -o $@
-
-$(TARGET): boot32.o $(TARGET).bin.o
-       $(CC) -m32 -N -Wl,-melf32ppclinux -static -nostdlib \
-               -Wl,-Ttext,$(boot32_link_base)  -Wl,-Tdata,$(xen_link_base) \
-               $(CFLAGS) $^ -o $@
+               $^ $@
 
 asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(HDRS)
        $(CC) $(CFLAGS) -S -o $@ $<
@@ -147,4 +121,4 @@ dom0.bin: $(DOM0_IMAGE)
 
 clean::
        $(MAKE) -f $(BASEDIR)/Rules.mk -C of_handler clean
-       rm -f firmware firmware_image dom0.bin .xen-syms
+       rm -f firmware firmware_image.bin dom0.bin .xen-syms
diff --git a/xen/arch/powerpc/boot/boot32.S b/xen/arch/powerpc/boot/boot32.S
deleted file mode 100644 (file)
index 1b594b5..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2005 Jimi Xenidis <jimix@watson.ibm.com>, IBM Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- *
- */
-       
-### 32 bit strapping code so Of will like us
-       .section        ".text"
-       .align 3
-       .globl _start
-               
-_start:
-       ## Double word align the MSR value below
-       nop
-       bl _real_start
-       ## static value for MSR
-       .llong 0x9000000000001000
-
-       ## see also docs/reference/ppc/msr.txt
-##bit C  Hex               Name Desc
-##  0 63 80000000 00000000 SF   64-bit Mode
-##  3 60 10000000 00000000 HV   Hypervisor State iff PR = 0 in hypervisor state.
-## 51 12 00000000 00001000 ME   Machine Check Enable
-
-_real_start:           
-       # pass the original msr as argument to hype_init
-       mfmsr   8
-
-       ## Set PC
-       li      21, 0
-       oris    21, 21, _hype64@h
-       ori     21, 21, _hype64@l
-#ifdef __BRIDGE64__
-       ## In 64bit we use rfid to switch from 32bit to 64 bit
-       mtsrr0  21
-
-       ## Set MSR
-       mflr    21
-       ld      22, 0(21)
-       mtsrr1  22
-       bl __leap
-       /* should never return */
-       trap
-__leap:                
-       rfid
-#else
-       mtctr 21
-       bctrl
-       /* should never return */
-       trap
-#endif
-
-       
-_real_end:
-       .data
-       .align 3
-       ## Hypervisor starts here, at the first data address
-       ## linker magic positions _hype64 0x100 after _start
-       ## hype/ppc64/Makefile.isa 
-_hype64:               
-
-
diff --git a/xen/arch/powerpc/boot/start.S b/xen/arch/powerpc/boot/start.S
deleted file mode 100644 (file)
index aec4a48..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2005 Jimi Xenidis <jimix@watson.ibm.com>, IBM Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- *
- */
-
-#include <asm/config.h>
-#include <asm/processor.h>
-#include <asm/page.h>
-
-    .globl _start
-_start:
-    /* load up the stack */
-    SET_REG_TO_LABEL(r1, cpu0_stack)
-
-    /* call the init function */
-    LOADADDR(r21,__start_xen_ppc)
-
-#ifdef __PPC64__
-    ld r2, 8(r21)
-    ld r21, 0(r21)
-#endif
-    mtctr r21
-    bctrl
-    /* should never return */
-    trap
-
-    /* Note! GDB 6.3 makes the very stupid assumption that PC > SP means we are
-     * in a Linux signal trampoline, and it begins groping for a struct
-     * rt_sigframe on the stack. Naturally, this fails miserably for our
-     * backtrace. To work around this behavior, we must make certain that our
-     * stack is always above our text, e.g. in the data section. */
-    .data /* DO NOT REMOVE; see GDB note above */
-    .align 4
-cpu0_stack_bottom:
-    .space STACK_SIZE
-cpu0_stack:
-    .space STACK_FRAME_OVERHEAD
diff --git a/xen/arch/powerpc/start.S b/xen/arch/powerpc/start.S
new file mode 100644 (file)
index 0000000..9f4c21c
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * Copyright (C) 2005, 2006 IBM Corp.
+ *
+ * Authors: Jimi Xenidis <jimix@watson.ibm.com>
+ *          Hollis Blanchard <hollisb@us.ibm.com>
+ *
+ */
+
+#include <asm/config.h>
+#include <asm/msr.h>
+#include <asm/processor.h>
+#include <asm/page.h>
+
+    .globl _start
+_start:
+    /* pass the original MSR along */
+    mfmsr r8
+
+    /* set initial MSR */
+    li r22, 0
+    ori r22, r22, (MSR_SF | MSR_HV) >> 48
+    sldi r22, r22, 48
+    mtmsrd r22
+
+_start64:
+    /* load up the stack */
+    SET_REG_TO_LABEL(r1, cpu0_stack)
+
+    /* call the init function */
+    LOADADDR(r21,__start_xen_ppc)
+    ld r2, 8(r21)
+    ld r21, 0(r21)
+    mtctr r21
+    bctrl
+    /* should never return */
+    trap
+
+    /* Note! GDB 6.3 makes the very stupid assumption that PC > SP means we are
+     * in a Linux signal trampoline, and it begins groping for a struct
+     * rt_sigframe on the stack. Naturally, this fails miserably for our
+     * backtrace. To work around this behavior, we must make certain that our
+     * stack is always above our text, e.g. in the data section. */
+    .data /* DO NOT REMOVE; see GDB note above */
+    .align 4
+cpu0_stack_bottom:
+    .space STACK_SIZE
+cpu0_stack:
+    .space STACK_FRAME_OVERHEAD